<!DOCTYPE html>
<html>

<head lang="en">
    <meta charset="UTF-8">
    <title>分支语句</title>
</head>

<body>
    
<script>
    var score = "优";
    switch (score) {
        case "优":
            document.write("该同学成绩优异");
            break;
        case "良":
            document.write("该同学成绩良好");
            break;
        case "及格":
            document.write("该同学成绩及格");
            break;
        case "不及格":
            document.write("该同学成绩不及格");
            break;
        default:
            document.write("该同学成绩未知");
    }
</script>

</body>

</html>